package com.ms.springDemo;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.statemachine.annotation.OnTransition;
import org.springframework.statemachine.annotation.WithStateMachine;

/**
 * @author qingqing.liang
 * @create 2017-11-28
 **/
@WithStateMachine
public class MyBean {
    private Logger logger = LoggerFactory.getLogger(getClass());

    //============ 默认 start ============

    // 这样的写法有问题，cglib代理的方法只能是public

    //@OnTransition(target = "STATE1")
    //void toState1() {
    //}
    //
    //@OnTransition(target = "STATE2")
    //void toState2() {
    //}

    //============ 默认 end ============

    @OnTransition(target = "STATE1")
    public void toState1() {
        logger.info("状态变为STATE1");
    }

    @OnTransition(target = "STATE2")
    public void toState2() {
        logger.info("状态变为STATE2");
    }


}
